s=input()
#代码开始
s_digit=""
for char in s:
    if char.isdigit():
        s_digit+=char
s_list=list(s_digit)
sum_of_odd_index=0
sum_of_even_index=0
new_sum=0
for index in range(-2,-len(s_list)-1,-2):
    sum_of_odd_index+=int(s_list[index])
for index in range(-1,-len(s_list)-1,-2):
    sum_of_even_index+=int(s_list[index])
sum_of_even_index*=3
new_sum=sum_of_odd_index+sum_of_even_index
jym=(new_sum // 10 + 1)*10-new_sum if new_sum %10 !=0 else 0
#代码结束
print(jym)
